package cn.edu.scau.cmi.yangqing.hibernate.client;

import java.util.List;

import org.hibernate.Transaction;

import cn.edu.scau.cmi.yangqing.hibernate.domain.Student;
import cn.edu.scau.cmi.yangqing.hibernate.domain.Tutor;
import cn.edu.scau.cmi.yangqing.hibernate.service.StudentService;
import cn.edu.scau.cmi.yangqing.hibernate.service.TutorService;
import cn.edu.scau.cmi.yangqing.hibernate.util.HibernateUtil;

public class HibernateTest {
	
	public Student student = new Student();
	
	public static void main(String[] args) {
		
		TutorService tutorService = new TutorService();
		
		Tutor tutor = new Tutor();
		
		//tutor.setId("1");
		//tutor.setName("baibai");
		//tutorService.addTutor(tutor);
		
		//tutorService.deleteTutor(4);
		
//		tutor = tutorService.findTutorById(3);
//		System.out.println(tutor);
//		tutor.setName("dunka00");
//		System.out.println(tutor);
//		tutorService.updateTutor(tutor);
		
//		List<Tutor> list = tutorService.findAllTutor();
//		for (Tutor tutor2 : list) {
//			System.out.println(tutor2);
//		}
//		
		
		List<Student> list = tutorService.teachNoStudentList(3);
		for (Student student : list) {
			System.out.println(student);
		}
		
//		tutorService.teachStudent(2, 1);
		
//		tutorService.teachNoStudent(1);
		
//		tutor = tutorService.findTutorById(1);
	
			
		//System.out.println(tutor);
		
//		StudentService studentService = new StudentService();
//		studentService.deleteStudent(13);
//		
//		Student student = new Student();
//		Tutor tutor = new Tutor();
//		tutor.setId(1);
//		student.setName("dunka");
//		student.setTutor(tutor);
//		studentService.addStudent(student);
		
//		studentService.deleteStudent(10);
		
//		student = studentService.findStudentById(11);
//		System.out.println(student);
		
//		student = studentService.findStudentById(11);
//		student.setName("666");
//		studentService.updateStudent(student);
		
//		List<Student> list1 = studentService.findAllStudent();
//		for (Student student2 : list1) {
//			System.out.println(student2);
//			System.out.println(student2.getTutor().getId());
//		}
//		studentService.teachTutor(2, 9);
		System.out.println("got you~");
	}
}
